Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

decamelize-keys

Package Overview
Dependencies
Maintainers
2
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

decamelize-keys

Convert object keys from camelCase to lowercase with a custom separator

  • 1.1.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
10M
increased by3.75%
Maintainers
2
Weekly downloads
 
Created

What is decamelize-keys?

The `decamelize-keys` npm package is designed to convert object keys from camelCase to lowercase with a customizable separator, making it useful for transforming JavaScript object keys to match different coding or data format conventions.

What are decamelize-keys's main functionalities?

Convert object keys from camelCase to a custom separator

This feature allows you to convert the keys of an object from camelCase to another format using a custom separator, such as a hyphen. It's particularly useful for preparing data to be sent to APIs or systems that require a different naming convention.

const decamelizeKeys = require('decamelize-keys');
const result = decamelizeKeys({ 'fooBar': true, 'barBaz': 'yes' }, '-');
console.log(result); // Output: { 'foo-bar': true, 'bar-baz': 'yes' }

Exclude specific keys from being decamelized

This functionality allows you to exclude certain keys from being transformed. It's useful when you have specific keys that need to remain in camelCase for consistency or compatibility reasons.

const decamelizeKeys = require('decamelize-keys');
const options = { exclude: ['fooBar'] };
const result = decamelizeKeys({ 'fooBar': true, 'barBaz': 'yes' }, '-', options);
console.log(result); // Output: { 'fooBar': true, 'bar-baz': 'yes' }

Other packages similar to decamelize-keys

Keywords

FAQs

Package last updated on 30 Oct 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc